function PE_CHAT_OVERRIDE ( Player, Text )
	// Local Chat :D
	
	for k, v in pairs(player.GetAll()) do if v:IsAdmin() then v:PrintMessage(HUD_PRINTCONSOLE, '[Local] ' .. Player:Nick() .. ": " .. Text); end end
	
	Msg('[Local] ' .. Player:Nick() .. ": " .. Text .. "\n");
	for k, v in pairs(ents.FindInSphere(Player:GetPos(), ChatRadius_Local)) do
		if v and v:IsValid() and v:IsPlayer() then
			umsg.Start('PE_CUSTOMCHAT', v);
				umsg.Entity(Player);
				umsg.String(Text);
				umsg.Short(CHAT_LOCAL);
			umsg.End();
		end
	end
	
	for k, v in pairs(player.GetAll()) do
		if v:GetTable().Spectating and v:GetTable().Spectating:IsValid() and v:GetTable().Spectating:IsPlayer() and v:GetTable().Spectating:GetPos():Distance(Player:GetPos()) < ChatRadius_Local then
			umsg.Start('PE_CUSTOMCHAT', v);
				umsg.Entity(Player);
				umsg.String(Text);
				umsg.Short(CHAT_LOCAL);
			umsg.End();
		end
	end
	
	// block it out, o' course
	return "";
end
/*
function GM.CHAT_GLOBAL ( Player, Text, LessCommand )

	local const_P2PChatPrefix = "/global";
	
	if(string.Left(text, string.len(const_P2PChatPrefix)) == const_P2PChatPrefix) then
		local clean = string.Trim(string.Right(text, string.len(text) - string.len(const_P2PChatPrefix)));
	
		local ServerID = ChatName or "Dev";
	
		MySQLQuery(SiteDatabaseConnection, "INSERT INTO `global_chat` (`server_id`, `user_name`, `message`) VALUES ('" .. StripForHTTP(ServerID) .. "', '" .. StripForHTTP(Player:Name()) .. "', '" .. StripForHTTP(Text) .. "')");
		
		umsg.Start('PE_GLOBALCHAT');
			umsg.Entity(Player);
			umsg.String(Text);
			umsg.Short(CHAT_GLOBAL);
		umsg.End();
			
		Msg(Player:Nick() .. ": " .. Text .. "\n");
		return "";
	
		end
	end
AddChatCommand('global', GM.CHAT_GLOBAL);
*/
local const_P2PChatPrefix = "/global";

function ChatGlobal(name, steam, message, adminonly)

	MySQLQuery(SiteDatabaseConnection, "INSERT INTO `global_chat` (`server_id`, `user_name`, `message`) VALUES ('" .. StripForHTTP("#5 | TTT") .. "', '" .. StripForHTTP(tostring(name)) .. "', '" .. StripForHTTP(tostring(message)) .. "')");
	
	local filter = RecipientFilter();
	
	filter:AddAllPlayers();

	
	umsg.Start("PE_GLOBALCHAT", filter);
		umsg.String(tostring(name));
		umsg.String(tostring(message));
	umsg.End();
end

function P2PPlayerSay(ply, text, all)
	if(string.Left(text, string.len(const_P2PChatPrefix)) == const_P2PChatPrefix) then
		local clean = string.Trim(string.Right(text, string.len(text) - string.len(const_P2PChatPrefix)));
		ChatGlobal(ply:Nick(), ply:SteamID(), clean, false);
		return "";
	end
end
hook.Add("PlayerSay", 1, P2PPlayerSay);
AddChatCommand('global', P2PPlayerSay);